Skip to content

Commit 63976b8

Browse files
Libc-1698.100.8
Imported from Libc-1698.100.8.tar.gz
1 parent af11da5 commit 63976b8

File tree

125 files changed

+4345
-1398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+4345
-1398
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
indent_size = 8
8+
indent_style = tab

.upstream_base_commits

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ string/FreeBSD/strcasecmp.3 freebsd lib/libc/string/strcasecmp.3 5174a6a262d28e1
810810
string/FreeBSD/strcasecmp.c freebsd lib/libc/string/strcasecmp.c bd604b4b064135e661660c045cd31145e2e4ce71
811811
string/FreeBSD/strcasestr.c freebsd lib/libc/string/strcasestr.c bd604b4b064135e661660c045cd31145e2e4ce71
812812
string/FreeBSD/strcat.3 freebsd lib/libc/string/strcat.3 ef33e7368a5be64385219b7c212071e25d2528ad
813-
string/FreeBSD/strchr.3 freebsd lib/libc/string/strchr.3 5174a6a262d28e127da375394374b40dc9f3127d
813+
string/FreeBSD/strchr.3 freebsd lib/libc/string/strchr.3 dc36d6f9bb1753f3808552f3afd30eda9a7b206a
814814
string/FreeBSD/strcmp.3 freebsd lib/libc/string/strcmp.3 2ce5c85ed065b37eb3c759877f3a287dd032c716
815815
string/FreeBSD/strcoll.3 freebsd lib/libc/string/strcoll.3 c879ae3536e6d92b8d96c8965c5b05fcb9541520
816816
string/FreeBSD/strcoll.c freebsd lib/libc/string/strcoll.c bd604b4b064135e661660c045cd31145e2e4ce71
@@ -882,7 +882,9 @@ string/FreeBSD/wmemset.c freebsd lib/libc/string/wmemset.c ea58272861af2404aa2c8
882882
sys/OpenBSD/stack_protector.c openbsd lib/libc/sys/stack_protector.c 3fb315b1c38f6a51d2b0b8852f7796476bf816a3
883883
sys/nanosleep.2 freebsd lib/libc/sys/nanosleep.2 32eef9aeb1f39a1623cea55da147c89abbd5b9a5
884884
sys/sigwait.2 freebsd lib/libc_r/man/sigwait.3 32eef9aeb1f39a1623cea55da147c89abbd5b9a5
885+
string/FreeBSD/strchrnul.c freebsd lib/libc/string/strchrnul.c 559a218c9b257775fb249b67945fe4a05b7a6b9f
885886
tests/FreeBSD/gen/popen_test.c freebsd lib/libc/tests/gen/popen_test.c 397f4a0de5c2ffeda63fb81930d94a51bc248ff6
887+
tests/FreeBSD/string/t_strchrnul.c freebsd contrib/netbsd-tests/lib/libc/string/t_strchrnul.c 606d0e4a9a862a7b4e3469a084834ca0e888afa4
886888
tests/freebsd_fmemopen.c freebsd lib/libc/tests/stdio/fmemopen2_test.c a3422d96bd4c08d07bb6c1984c86578b67ee6a41
887889
tests/freebsd_glob.c freebsd lib/libc/tests/gen/glob2_test.c 215b15da57f0caef9e0ec0641dc108fa5b909784
888890
tests/freebsd_open_memstream.c freebsd lib/libc/tests/stdio/open_memstream2_test.c a3422d96bd4c08d07bb6c1984c86578b67ee6a41

Libc.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5452,6 +5452,7 @@
54525452
CB5A46C72AB22D9900756493 /* quick_exit.c in Sources */ = {isa = PBXBuildFile; fileRef = CB5A46BF2AB22D9900756493 /* quick_exit.c */; };
54535453
CB5A46C82AB22D9900756493 /* quick_exit.c in Sources */ = {isa = PBXBuildFile; fileRef = CB5A46BF2AB22D9900756493 /* quick_exit.c */; };
54545454
CB5A46C92AB22D9900756493 /* quick_exit.c in Sources */ = {isa = PBXBuildFile; fileRef = CB5A46BF2AB22D9900756493 /* quick_exit.c */; };
5455+
CBDCAA292985BE4A00657251 /* strchrnul.c in Sources */ = {isa = PBXBuildFile; fileRef = CBDCAA1E2985BCE200657251 /* strchrnul.c */; };
54555456
E408425B20B585BF00CC87A7 /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; };
54565457
F749336D240DBC2000B709CC /* boot_mode_private.h in Headers */ = {isa = PBXBuildFile; fileRef = F749336C240DBBB100B709CC /* boot_mode_private.h */; settings = {ATTRIBUTES = (Private, ); }; };
54575458
FC2ED610157D4BE80098EC69 /* inet_ntop.c in Sources */ = {isa = PBXBuildFile; fileRef = FC2ED60E157D4BE70098EC69 /* inet_ntop.c */; };
@@ -5825,6 +5826,7 @@
58255826
8478AB072A6B57FC00739600 /* _abort.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _abort.h; sourceTree = "<group>"; };
58265827
8478AB082A6B942200739600 /* _static_assert.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _static_assert.h; sourceTree = "<group>"; };
58275828
847CB4CB2A267A7A006542FC /* _strings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _strings.h; sourceTree = "<group>"; };
5829+
848D15922C953EB500E3DAFA /* _locale_t.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _locale_t.h; sourceTree = "<group>"; };
58285830
84D4AC2C2A69D5260019CD3D /* _inttypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _inttypes.h; sourceTree = "<group>"; };
58295831
84D4AC2D2A69D7C90019CD3D /* _langinfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _langinfo.h; sourceTree = "<group>"; };
58305832
84D4AC2E2A69D89F0019CD3D /* _monetary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _monetary.h; sourceTree = "<group>"; };
@@ -5836,6 +5838,7 @@
58365838
84D4AC342A6A04150019CD3D /* _ctermid.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _ctermid.h; sourceTree = "<group>"; };
58375839
84D4AC352A6A04150019CD3D /* _wctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _wctype.h; sourceTree = "<group>"; };
58385840
84D4AC362A6A07470019CD3D /* _xlocale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _xlocale.h; sourceTree = "<group>"; };
5841+
89AE50BD2CBF17DA0033218E /* _bounds.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _bounds.h; sourceTree = "<group>"; };
58395842
922D0C0821BFA1520072834D /* timespec_get.3 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = timespec_get.3; sourceTree = "<group>"; };
58405843
922D0C0921BFA1530072834D /* timespec_get.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = timespec_get.c; sourceTree = "<group>"; };
58415844
926F73921E03E2A3001E049D /* libsystem_darwin.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libsystem_darwin.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -6996,6 +6999,7 @@
69966999
CB5A46BE2AB22D9800756493 /* quick_exit.3 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = quick_exit.3; sourceTree = "<group>"; };
69977000
CB5A46BF2AB22D9900756493 /* quick_exit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = quick_exit.c; sourceTree = "<group>"; };
69987001
CB5A46CA2AB22DB900756493 /* psort.3 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = psort.3; sourceTree = "<group>"; };
7002+
CBDCAA1E2985BCE200657251 /* strchrnul.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strchrnul.c; sourceTree = "<group>"; };
69997003
E40EA6C01EAA8F9300B2FA36 /* _strings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _strings.h; sourceTree = "<group>"; };
70007004
E41BEA97178E72E100E348BB /* Libc.order */ = {isa = PBXFileReference; lastKnownFileType = text; path = Libc.order; sourceTree = "<group>"; };
70017005
E464104B224C5EA2001B23EF /* ___wctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "___wctype.h"; sourceTree = "<group>"; };
@@ -8016,6 +8020,7 @@
80168020
C9B53854138D9E990028D27C /* __xlocale.h */,
80178021
8478AB072A6B57FC00739600 /* _abort.h */,
80188022
8478AB052A6B56AC00739600 /* _assert.h */,
8023+
89AE50BD2CBF17DA0033218E /* _bounds.h */,
80198024
84D4AC342A6A04150019CD3D /* _ctermid.h */,
80208025
E464104C224C5F19001B23EF /* _ctype.h */,
80218026
84D4AC2C2A69D5260019CD3D /* _inttypes.h */,
@@ -8977,6 +8982,7 @@
89778982
C9B53D17138D9E9A0028D27C /* strcasestr.c */,
89788983
C9B53D19138D9E9A0028D27C /* strcat.3 */,
89798984
C9B53D1C138D9E9A0028D27C /* strchr.3 */,
8985+
CBDCAA1E2985BCE200657251 /* strchrnul.c */,
89808986
C9B53D20138D9E9A0028D27C /* strcmp.3 */,
89818987
C9B53D24138D9E9A0028D27C /* strcoll.3 */,
89828988
C9B53D26138D9E9A0028D27C /* strcoll.c */,
@@ -9199,6 +9205,7 @@
91999205
isa = PBXGroup;
92009206
children = (
92019207
FC60BAD116555A4A00033196 /* _intmax_t.h */,
9208+
848D15922C953EB500E3DAFA /* _locale_t.h */,
92029209
FC60BAD216555A4A00033196 /* _nl_item.h */,
92039210
FC60BAD316555A4A00033196 /* _uint16_t.h */,
92049211
FC60BAD416555A4A00033196 /* _uint32_t.h */,
@@ -11308,6 +11315,7 @@
1130811315
C9258018138E1CD200B3107C /* rindex.c in Sources */,
1130911316
C925801B138E1CD200B3107C /* strcasecmp.c in Sources */,
1131011317
C925801C138E1CD200B3107C /* strcasestr.c in Sources */,
11318+
CBDCAA292985BE4A00657251 /* strchrnul.c in Sources */,
1131111319
C9258020138E1CD200B3107C /* strcoll.c in Sources */,
1131211320
C9258022138E1CD200B3107C /* strcspn.c in Sources */,
1131311321
C9258023138E1CD200B3107C /* strdup.c in Sources */,

darwin/libc_private.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@
2424
#ifndef __LIBC_PRIVATE_H__
2525
#define __LIBC_PRIVATE_H__
2626

27+
#include <_bounds.h>
2728
#include <mach/vm_types.h>
2829
#include <os/availability.h>
2930
#include <sys/cdefs.h>
3031
#include <stddef.h>
3132

33+
_LIBC_SINGLE_BY_DEFAULT()
34+
3235
__BEGIN_DECLS
3336

3437
/* Hello and welcome to libc_private.h. This header file has four jobs to do:
@@ -64,8 +67,8 @@ API_AVAILABLE(macos(12.3), ios(15.4), tvos(15.4), watchos(8.5))
6467
extern void environ_unlock_np(void);
6568

6669

67-
typedef void (*backtrace_get_pcs_func_t)(vm_address_t *buffer, unsigned max,
68-
unsigned *nb, unsigned skip, void *startfp);
70+
typedef void (*backtrace_get_pcs_func_t)(vm_address_t *_LIBC_COUNT(max) buffer,
71+
unsigned max, unsigned *nb, unsigned skip, void *startfp);
6972

7073
API_AVAILABLE(macos(13.3), ios(16.4), tvos(16.4), watchos(9.5))
7174
extern void backtrace_set_pcs_func(backtrace_get_pcs_func_t func);

darwin/subsystem.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
#ifndef __SUBSYSTEM_H__
2525
#define __SUBSYSTEM_H__
2626

27+
#include <_bounds.h>
2728
#include <sys/stat.h>
2829

30+
_LIBC_SINGLE_BY_DEFAULT()
31+
2932
__BEGIN_DECLS
3033
/*
3134
* Returns an fd for the given path, relative to root or to

exclave/dirent.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@
5959
#define _DIRENT_H_
6060

6161
#include <sys/cdefs.h>
62+
#include <_bounds.h>
6263
#include <stdint.h>
6364

65+
_LIBC_SINGLE_BY_DEFAULT()
66+
6467
typedef struct __EXCLAVE_DIR DIR;
6568

6669
#define __EXCLAVE_MAXPATHLEN 1024

exclave/sys/fcntl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@
7171
#define _SYS_FCNTL_H_
7272

7373
#include <sys/cdefs.h>
74+
#include <_bounds.h>
7475
#include <_compat/sys/_types.h>
7576

77+
_LIBC_SINGLE_BY_DEFAULT()
78+
7679
/*
7780
* File status flags: these are used by open(2), fcntl(2).
7881
* They are also used (indirectly) in the kernel file structure f_flags,

fbsdcompat/_fbsd_compat_.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
#define __raise raise
165165
#define __signalcontext signalcontext
166166
#define __sleep sleep
167+
#define __strchrnul strchrnul
167168
#define __strtok_r strtok_r
168169
#define __swapcontext swapcontext
169170
#define __system system

gen/clock_gettime.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ clock_gettime_nsec_np(clockid_t clock_id)
104104

105105
// Mach Absolute Time unit-based calls
106106
mach_timebase_info_data_t tb_info;
107-
if (mach_timebase_info(&tb_info)) return 0;
107+
kern_return_t kr = mach_timebase_info(&tb_info);
108+
if (kr != KERN_SUCCESS) {
109+
errno = EINVAL;
110+
return 0;
111+
}
108112
uint64_t mach_time;
109113

110114
switch(clock_id){
@@ -195,7 +199,9 @@ clock_getres(clockid_t clk_id, struct timespec *res)
195199
case CLOCK_UPTIME_RAW_APPROX:
196200
case CLOCK_THREAD_CPUTIME_ID: {
197201
mach_timebase_info_data_t tb_info;
198-
if (mach_timebase_info(&tb_info)){
202+
kern_return_t kr = mach_timebase_info(&tb_info);
203+
if (kr != KERN_SUCCESS) {
204+
errno = EINVAL;
199205
return -1;
200206
}
201207
res->tv_nsec = tb_info.numer / tb_info.denom + (tb_info.numer % tb_info.denom != 0);

gen/errlst.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ const char *const sys_errlist[] = {
184184
"Policy not found", /* 103 - ENOPOLICY */
185185
"State not recoverable", /* 104 - ENOTRECOVERABLE */
186186
"Previous owner died", /* 105 - EOWNERDEAD */
187-
188187
"Interface output queue is full", /* 106 - EQFULL */
188+
"Capabilities insufficient", /* 107 - ENOTCAPABLE */
189189
};
190190

191191
const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]);

0 commit comments

Comments
 (0)